package com.stx.threeGrup.service.impl;

import com.stx.threeGrup.mapper.UserMapperM;
import com.stx.threeGrup.model.automodel.User;
import com.stx.threeGrup.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2019/6/10
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapperM userMapperM ;
    @Override
    public boolean login(String username,String password) {
        User user = userMapperM.queryUserByUserName(username);
        String userPass = user.getUserPass();
        System.out.println(userPass);
        if(userPass!=null){
            if(userPass.equals(password)){
                return true;
            }
        }
        return false;
    }

    @Override
    public int register(User user) {
        int rs = userMapperM.addUser(user);
        return rs;
    }

    @Override
    public List<User> queryUserAll() {
        return userMapperM.queryUserAll();
    }

    @Override
    public User queryUserByUserName(String username) {
        return userMapperM.queryUserByUserName(username);
    }

    @Override
    public int deleteUser(int id) {
        int rs  = userMapperM.deleteUser(id);
        return rs;
    }
}
